package com.bree.erp.entity;

import java.io.Serializable;

public class WarehousePartUnitId implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private Warehouse warehouse;
	private PartUnit partUnit;
	
	public WarehousePartUnitId(Warehouse warehouse, PartUnit partUnit) {
		this.warehouse = warehouse;
		this.partUnit = partUnit;
	}
	
	@Override
	public boolean equals(Object object) {
		if(this == object) {
			return true;
		}
		
		if(object instanceof WarehousePartUnitId) {
			WarehousePartUnitId that = (WarehousePartUnitId) object;
			
			return this.warehouse != null && this.partUnit != null
					&& this.warehouse.equals(that.warehouse) 
					&& this.partUnit.equals(that.partUnit);
		}
		
		return false;
	}
	
	@Override
	public int hashCode() {
		return this.partUnit == null ? 0 : this.partUnit.hashCode();
	}

	/**
	 * @return the warehouse
	 */
	public Warehouse getWarehouse() {
		return warehouse;
	}

	/**
	 * @return the partUnit
	 */
	public PartUnit getPartUnit() {
		return partUnit;
	}
	
}
